package demo.service;

import org.omg.CORBA.UserException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import demo.dao.UserMapper;
import demo.model.User;

@Service("userService")
public class UserService implements IUserService{

	private UserMapper userMapper;

	@Autowired
	public void setUserMapper(UserMapper userMapper)
	{
		this.userMapper = userMapper;
	}
	
	@Override
	public User login(String userName, String password) {
		User u = userMapper.getUserByName(userName);
		if (u == null || !u.getPassword().equals(password)) {
			return null;
		}
		return u;
	}

}
